Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lambda][flare] Build endpoint URL from environment variables #967

Conversation

nhulston
Copy link
Contributor

@nhulston nhulston commented Jul 10, 2023

What and why?

We want to use environment variables DATADOG_SITE or DD_SITE to build the endpoint URL to send flare files to. This ensures that user experience low latencies.
In the case where neither environment variable is set, we will use DATADOG_SITE_US1 = 'datadoghq.com' to default to US1.

How?

  • Create the getEndpointUrl() function that calculates and returns the full endpoint URL as a string
  • Determine the base URL with priority (1) DATADOG_SITE, (2) DD_SITE, or (3) the default Datadog site DATADOG_SITE_US1, if neither environment variable is set.
  • Append https:// to the endpoint

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jul 10, 2023

Datadog Report

Branch report: nicholas.hulston/serverless-flare/use-dd-site-for-endpoint-url
Commit report: 6762a0b

datadog-ci-tests: 0 Failed, 0 New Flaky, 819 Passed, 0 Skipped, 54.97s Wall Time

@nhulston nhulston marked this pull request as ready for review July 10, 2023 18:58
@nhulston nhulston requested a review from a team as a code owner July 10, 2023 18:58
Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left multiple comments.

@nhulston nhulston requested a review from duncanista July 11, 2023 19:21
@nhulston nhulston requested a review from duncanista July 11, 2023 23:57
Comment on lines +735 to +741
beforeEach(() => {
process.env = {...ORIGINAL_ENV}
})

afterAll(() => {
process.env = ORIGINAL_ENV
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@nhulston nhulston merged commit ba3d788 into serverless-flare Jul 12, 2023
10 checks passed
@nhulston nhulston deleted the nicholas.hulston/serverless-flare/use-dd-site-for-endpoint-url branch July 12, 2023 14:32
@duncanista duncanista mentioned this pull request Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants